function [bP, bQ] = hornersPolynomialMethod(polynomialCoeffs,pointX)
%HORNERSPOLYNOMIALMETHOD 
%   This algorithm was adapted from Chapter 2.6 of Numerical Analysis (8th
%   edition, Burden & Faires)
%   
%   *Input Parameters*
%   polynomialCoeffs:The scalar factors to each polynomial coefficients
%   pointX: Point where polynomial is to be evaluated
%
%   ***If no fixed point is found after maxIteration, the midpoint for 
%   maxIter approximation is returned.***
%
%   ***********************************************************************
%   Author: Mathieu Boudreau, BSc, MSc, PhD Candidate (BME)
%   Institute: Montreal Neurological Institute, McGill University
%   Contact: mathieu.boudreau2 (at) mail.mcgill.ca
%   Date: July 17th 2014
%   ***********************************************************************

%% Initialize initial conditions
%
degreePolynom = length(polynomialCoeffs);
initIter=degreePolynom-1;

bP = polynomialCoeffs(degreePolynom);
bQ = bP;

%% Run Horners Polynomial Algorithm
%

for iter=initIter:-1:2
    bP = pointX*bP+polynomialCoeffs(iter);
    bQ = pointX*bQ+bP;
end

bP = pointX*bP+polynomialCoeffs(1);

